// 员工管理相关页面接口
import request from '@/utils/request'

/**
 * @description 获取员工列表
 * @param {*} page
 * @param {*} size
 * @returns Promise
 */
export const getEmployeesList = (page, size) => {
  return request({
    url: '/sys/user',
    params: {
      page,
      size
    }
  })
}

/**
 * @description: 删除员工
 * @param {*} id 员工id
 * @return {*}
 */
export function delEmployee(id) {
  return request({
    url: `/sys/user/${id}`,
    method: 'delete'
  })
}

/**
 * @description 新增员工
 * @param {*} data
 * @returns Promise
 */
export const addEmployee = (data) => {
  return request({
    url: '/sys/user',
    method: 'POST',
    data
  })
}

/**
 * @description 保存员工基本信息
 * @param {*} id
 * @param {*} data
 * @returns Promise
 */
export const saveUserDetailById = (data) => {
  return request({
    url: `/sys/user/${data.id}`,
    method: 'PUT',
    data
  })
}

// 批量导入员工
export const importEmployees = (data) => {
  return request({
    url: '/sys/user/batch',
    method: 'POST',
    data
  })
}
